import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { environment } from '../environments/environment';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
})
export class AppComponent {
  data!: number;

  score: number = 0;

  constructor(private http: HttpClient) {}

  ngOnInit() {
    this.getData();
  }

  getData() {
    this.http.get(`${environment.baseUrl}/api/data`).subscribe(
      (response: any) => {
        this.data = response[0].report_data;
        for (let i = 0; i < response.length; i++) {
          console.log(response[i].report_data);
        }
      },
      (error) => {
        console.log(error);
      }
    );
  }
}
